package org.example.thread.thread01;

import lombok.SneakyThrows;

/**
 * @Auther:Liu
 * @Testname:Demo0402
 * @Date:2025/8/14 11:02
 */
public class Demo0402 {

    @SneakyThrows
    public  void changeNUm(){
        String name = Thread.currentThread().getName();
        System.out.println(name + "准备去厕所" );
        synchronized(this) {
            System.out.println(name + "给厕所上锁" );
            Thread.sleep(3000);
            System.out.println(name + "给厕所解锁" );
        }
    }
}
